Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

718
Views
Undefined array key "id". Laravel 8 send:notification command

I am trying to send a notification to the enrolled users in an event a day before the event's start date. I have a user table events table that contains the start date of each event. Also, I have an enrollment table that includes the user_id and event_id as foreign keys and the start date of these events. However, while I was trying to code the logic of this function and executing it, I got this error.

class SendNotification extends Command

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You are using collection when you call Model::all() and you are trying to use it like an array but it is a collection.

$enrolls = Enroll::all()->keyBy('user_id')->all();

then run your if check like

if (isset($enrolls[$user->id]))

I can not copy your code because you shared screenshot not a code. So be aware of that for your next question.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!